package com.ruyuan.user.server.domain.strategy;

import com.ruyuan.user.api.model.enums.AuthResourceTypeEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xx
 */
public class AuthorityGenerateStrategyFactory {

    private static final Map<AuthResourceTypeEnum, AuthorityGenerateStrategy> strategyMap = new HashMap<>();

    static {
        strategyMap.put(AuthResourceTypeEnum.MENU, new MenuAuthorityGenerateStrategy());
        strategyMap.put(AuthResourceTypeEnum.API, new ApiAuthorityGenerateStrategy());
        strategyMap.put(AuthResourceTypeEnum.OPERATION, new OperationAuthorityGenerateStrategy());
    }

    public static AuthorityGenerateStrategy buildStrategy(AuthResourceTypeEnum typeEnum) {
        return strategyMap.get(typeEnum);
    }

}
